package com.fx.controller;

import javafx.beans.property.ReadOnlyDoubleProperty;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.MenuBar;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;

import java.net.URL;
import java.util.ResourceBundle;

public abstract class AbsFxWindowController implements Initializable {

    @FXML
    private HBox windowTools;

    @FXML
    private MenuBar windowMenuBar;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        // 宽度绑定
        windowTools.prefWidthProperty().bind(bindWidth());
        windowTools.prefHeightProperty().bind(windowMenuBar.heightProperty());
        init();
        showTool();
    }

    private void showTool(){
        ImageView iconView = new ImageView(new Image(icons()));
    }

    protected abstract String icons();

    protected abstract void init();

    protected abstract ReadOnlyDoubleProperty bindWidth();

}
